home *** CD-ROM | disk | FTP | other *** search
Wrap
function loadLevel(lev) { var _loc2_ = levels[lev]; launchinterval = _loc2_[1]; speed = _loc2_[0]; emittens = _loc2_[2]; bullets = _loc2_[3]; numbullets = _loc2_[4]; changedir = _loc2_[5]; cycles = _loc2_[6]; elapsedcycles = 0; totalcycles = cycles; hit = 3; circleinterval = 0.006544984694978735 * speed; bcircleinterval = 0.005235987755982988 * speed; health_bar.gotoAndStop(health + 1); level = lev; level_field.text = "Level " + (lev + 1); score_field.text = score; cycle_field.text = "Experience: " + elapsedcycles + "/" + totalcycles; var _loc4_ = this.createEmptyMovieClip("game",0); hero = _loc4_.attachMovie("hero","hero",0); hero._x = hero._y = 250; hero.position = ""; hero.oldposition = ""; fx = this.createEmptyMovieClip("fx",3); hero.onEnterFrame = live; clock = setInterval(setShoot,launchinterval); columnsound.gotoAndStop(2); mute_music.onRelease = function() { if(columnsound._currentframe == 2) { this.gotoAndStop(2); columnsound.gotoAndPlay(3); } if(columnsound._currentframe == 1) { this.gotoAndStop(1); columnsound.gotoAndStop(2); } }; mute_sound.onRelease = function() { audio_on = !audio_on; if(audio_on) { this.gotoAndStop(1); } else { this.gotoAndStop(2); } }; } function live() { var _loc2_ = ""; if(Key.isDown(38)) { _loc2_ += "up"; } else if(Key.isDown(40)) { _loc2_ += "down"; } else { _loc2_ += ""; } if(Key.isDown(37)) { _loc2_ += "left"; } else if(Key.isDown(39)) { _loc2_ += "right"; } else { _loc2_ += ""; } if(_loc2_ == "") { _loc2_ = "still"; } if(this.position != "damage" && this.position != "damaged") { this.position = _loc2_; if(this.position != this.oldposition && this.position != "still") { if(audio_on) { sound.gotoAndPlay("swish"); } this.oldposition = this.position; } if(this.position == "still") { this.oldposition = "still"; } this.gotoAndStop(_loc2_); } else if(this.position == "damage") { this.position = "damaged"; if(audio_on) { sound.gotoAndPlay("hurt"); } this.gotoAndPlay("damage"); } if(score < tempscore) { score++; score_field.text = score; } } function setShoot() { if(numbullets > 1) { var _loc1_ = Math.round(Math.random()); if(_loc1_ == 0) { shootSingle(); } else { shootMultiple(); } } else { shootSingle(); } } function shootSingle() { if(bullets.length == 4 || bullets.length == 8) { var _loc6_ = Math.round(Math.random() * 3); } else if(bullets.length == 5 || bullets.length == 9) { _loc6_ = Math.round(Math.random() * 4); } var _loc7_ = game.getNextHighestDepth(); var _loc4_ = 0; var _loc3_ = 0; var _loc8_ = emittens[Math.round(Math.random() * (emittens.length - 1))]; _loc4_ = _loc8_[0]; _loc3_ = _loc8_[1]; if(changedir) { var _loc11_ = Math.round(Math.random() * 2) / 2; } else { _loc11_ = 0; } if(_loc4_ != 0 && _loc3_ != 0) { if(bullets.length > 5) { _loc6_ += 4; } } var _loc5_ = bullets[_loc6_]; if(_loc5_ == "bonus") { var _loc9_ = true; } else { _loc9_ = false; } var _loc1_ = game.attachMovie("bullet","bullet" + _loc7_,_loc7_); _loc1_.gotoAndStop(_loc5_); _loc1_.bonus = _loc9_; if(_loc4_ < 0) { _loc1_._x = -50; } else if(_loc4_ > 0) { _loc1_._x = 550; } else if(_loc4_ == 0) { _loc1_._x = 250; } if(_loc3_ < 0) { _loc1_._y = -50; } else if(_loc3_ > 0) { _loc1_._y = 550; } else if(_loc3_ == 0) { _loc1_._y = 250; } _loc1_.xdir = - _loc4_; _loc1_.ydir = - _loc3_; var _loc2_ = ""; if(_loc1_.ydir == -1) { _loc2_ += "down"; } else if(_loc1_.ydir == 1) { _loc2_ += "up"; } else { _loc2_ += ""; } if(_loc1_.xdir == -1) { _loc2_ += "right"; } else if(_loc1_.xdir == 1) { _loc2_ += "left"; } else { _loc2_ += ""; } if(_loc11_ == 1) { if(_loc2_ == "left") { _loc1_.evolute = "circle"; _loc2_ = "up"; var _loc10_ = 3.141592653589793; } else if(_loc2_ == "up") { _loc1_.evolute = "circle"; _loc2_ = "right"; _loc10_ = 3.141592653589793; } else if(_loc2_ == "right") { _loc1_.evolute = "circle"; _loc2_ = "down"; _loc10_ = 3.141592653589793; } else if(_loc2_ == "down") { _loc1_.evolute = "circle"; _loc2_ = "left"; _loc10_ = 3.141592653589793; } if(_loc2_ == "upleft") { _loc1_.evolute = "bcircle"; _loc2_ = "downleft"; _loc10_ = 3.141592653589793; } else if(_loc2_ == "upright") { _loc1_.evolute = "bcircle"; _loc2_ = "downright"; _loc10_ = 0; } else if(_loc2_ == "downleft") { _loc1_.evolute = "bcircle"; _loc2_ = "upleft"; _loc10_ = 3.141592653589793; } else if(_loc2_ == "downright") { _loc1_.evolute = "bcircle"; _loc2_ = "upright"; _loc10_ = 3.141592653589793; } _loc1_.interval = 0; } else { _loc1_.evolute = ""; } _loc1_._visible = false; _loc1_.position = _loc2_; _loc1_.startang = _loc10_; _loc1_.onEnterFrame = fly; } function shootMultiple() { if(bullets.length == 4 || bullets.length == 8) { var _loc7_ = Math.round(Math.random() * 3); } else if(bullets.length == 5 || bullets.length == 9) { _loc7_ = Math.round(Math.random() * 4); } var _loc9_ = game.getNextHighestDepth(); var _loc5_ = 0; var _loc4_ = 0; if(changedir) { var _loc12_ = Math.round(Math.random() * 2) / 2; } else { _loc12_ = 0; } var _loc10_ = emittens[Math.round(Math.random() * (emittens.length - 1))]; _loc5_ = _loc10_[0]; _loc4_ = _loc10_[1]; if(_loc5_ != 0 && _loc4_ != 0) { if(bullets.length > 5) { _loc7_ += 4; } } var _loc6_ = bullets[_loc7_]; if(_loc6_ == "bonus") { var _loc11_ = true; } else { _loc11_ = false; } var _loc1_ = game.attachMovie("bullet","bullet" + _loc9_,_loc9_); _loc1_.gotoAndStop(_loc6_); _loc1_.bonus = _loc11_; _loc9_ = game.getNextHighestDepth(); var _loc3_ = game.attachMovie("bullet","bullet" + _loc9_,_loc9_); _loc6_ = bullets[_loc7_]; if(_loc6_ == "bonus") { _loc6_ = "normal0"; } _loc3_.gotoAndStop(_loc6_); _loc3_.bonus = false; if(_loc5_ < 0) { _loc1_._x = -50; _loc3_._x = -100; } else if(_loc5_ > 0) { _loc1_._x = 550; _loc3_._x = 600; } else if(_loc5_ == 0) { _loc1_._x = 250; _loc3_._x = 250; } if(_loc4_ < 0) { _loc1_._y = -50; _loc3_._y = -100; } else if(_loc4_ > 0) { _loc1_._y = 550; _loc3_._y = 600; } else if(_loc4_ == 0) { _loc1_._y = 250; _loc3_._y = 250; } _loc1_.xdir = - _loc5_; _loc1_.ydir = - _loc4_; _loc3_.xdir = - _loc5_; _loc3_.ydir = - _loc4_; var _loc2_ = ""; if(_loc1_.ydir == -1) { _loc2_ += "down"; } else if(_loc1_.ydir == 1) { _loc2_ += "up"; } else { _loc2_ += ""; } if(_loc1_.xdir == -1) { _loc2_ += "right"; } else if(_loc1_.xdir == 1) { _loc2_ += "left"; } else { _loc2_ += ""; } if(_loc12_ == 1) { if(_loc2_ == "left") { _loc1_.evolute = "circle"; _loc2_ = "up"; var _loc8_ = 3.141592653589793; } else if(_loc2_ == "up") { _loc1_.evolute = "circle"; _loc2_ = "right"; _loc8_ = 3.141592653589793; } else if(_loc2_ == "right") { _loc1_.evolute = "circle"; _loc2_ = "down"; _loc8_ = 3.141592653589793; } else if(_loc2_ == "down") { _loc1_.evolute = "circle"; _loc2_ = "left"; _loc8_ = 3.141592653589793; } if(_loc2_ == "upleft") { _loc1_.evolute = "bcircle"; _loc2_ = "downleft"; _loc8_ = 3.141592653589793; } else if(_loc2_ == "upright") { _loc1_.evolute = "bcircle"; _loc2_ = "downright"; _loc8_ = 0; } else if(_loc2_ == "downleft") { _loc1_.evolute = "bcircle"; _loc2_ = "upleft"; _loc8_ = 3.141592653589793; } else if(_loc2_ == "downright") { _loc1_.evolute = "bcircle"; _loc2_ = "upright"; _loc8_ = 3.141592653589793; } } else { _loc1_.evolute = ""; _loc3_.evolute = ""; } _loc1_._visible = false; _loc3_._visible = false; _loc1_.position = _loc2_; _loc3_.position = _loc2_; _loc1_.startang = _loc8_; _loc3_.startang = _loc8_ + 0.7853981633974483; _loc1_.onEnterFrame = fly; _loc3_.onEnterFrame = fly; } function fly() { this._visible = true; if(this.evolute == "") { this._x += this.xdir * speed; this._y += this.ydir * speed; } else if(this.evolute == "circle") { if(this.position == "up") { this.startang += circleinterval; this._x = 250 * Math.cos(this.startang); this._y = 250 + 125 * Math.sin(this.startang); } else if(this.position == "right") { this.startang += circleinterval; this._x = 250 + 125 * Math.cos(this.startang); this._y = 250 * Math.sin(this.startang); } else if(this.position == "down") { this.interval += circleinterval; this._x = 500 + 250 * Math.cos(this.interval); this._y = 250 + 125 * Math.sin(this.interval); } else if(this.position == "left") { this.startang += circleinterval; this._x = 250 + 125 * Math.cos(this.startang); this._y = 500 + 250 * Math.sin(this.startang); } } else if(this.evolute == "bcircle") { if(this.position == "downleft") { this.startang -= bcircleinterval; this._x = 250 * Math.cos(this.startang); this._y = 500 * Math.sin(this.startang); } else if(this.position == "downright") { this.startang += bcircleinterval; this._x = 500 + 250 * Math.cos(this.startang); this._y = 500 * Math.sin(this.startang); } else if(this.position == "upleft") { this.startang += bcircleinterval; this._x = 250 * Math.cos(this.startang); this._y = 500 + 500 * Math.sin(this.startang); } else if(this.position == "upright") { this.startang -= bcircleinterval; this._x = 500 + 250 * Math.cos(this.startang); this._y = 500 + 500 * Math.sin(this.startang); } } this._rotation += 10; if(hero.hitTest(this)) { if(hero.position == this.position) { if(!this.bonus) { if(hit > 0) { hit--; scoreadd = 10; } else if(hit == 0) { scoreadd = 15; } var _loc2_ = fx.attachMovie("particle","part_" + fx.getNextHighestDepth(),fx.getNextHighestDepth()); _loc2_._xscale = _loc2_._yscale = 40; if(hero.position == "left") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y; } else if(hero.position == "up") { _loc2_._x = hero._x; _loc2_._y = hero._y - 30; } else if(hero.position == "right") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y; } else if(hero.position == "down") { _loc2_._x = hero._x; _loc2_._y = hero._y + 30; } else if(hero.position == "upleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y - 30; } else if(hero.position == "downleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y + 30; } else if(hero.position == "upright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y - 30; } else if(hero.position == "downright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y + 30; } tempscore += scoreadd; if(cycles > 0) { elapsedcycles++; cycles--; cycle_field.text = "Experience: " + elapsedcycles + "/" + totalcycles; } if(cycles == 0) { nextLevel(); } } else { if(health < 5) { health++; health_bar.gotoAndStop(health + 1); } _loc2_ = fx.attachMovie("particle_bonus","part_" + fx.getNextHighestDepth(),fx.getNextHighestDepth()); _loc2_._xscale = _loc2_._yscale = 40; if(hero.position == "left") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y; } else if(hero.position == "up") { _loc2_._x = hero._x; _loc2_._y = hero._y - 30; } else if(hero.position == "right") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y; } else if(hero.position == "down") { _loc2_._x = hero._x; _loc2_._y = hero._y + 30; } else if(hero.position == "upleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y - 30; } else if(hero.position == "downleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y + 30; } else if(hero.position == "upright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y - 30; } else if(hero.position == "downright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y + 30; } } if(audio_on) { sound.gotoAndPlay("punch"); } this.removeMovieClip(); } else { if(!this.bonus) { if(hero.position != "damage" && hero.position != "damaged") { _loc2_ = fx.attachMovie("particle_damage","part_" + fx.getNextHighestDepth(),fx.getNextHighestDepth()); _loc2_._xscale = _loc2_._yscale = 40; if(this.position == "left") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y; } else if(this.position == "up") { _loc2_._x = hero._x; _loc2_._y = hero._y - 30; } else if(this.position == "right") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y; } else if(this.position == "down") { _loc2_._x = hero._x; _loc2_._y = hero._y + 30; } else if(this.position == "upleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y - 30; } else if(this.position == "downleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y + 30; } else if(this.position == "upright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y - 30; } else if(this.position == "downright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y + 30; } hero.position = "damage"; hit = 3; this.xdir = this.ydir = 0; health--; health_bar.gotoAndStop(health + 1); if(health == 0) { die(); } } } else { _loc2_ = fx.attachMovie("particle_damage","part_" + fx.getNextHighestDepth(),fx.getNextHighestDepth()); _loc2_._xscale = _loc2_._yscale = 40; if(this.position == "left") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y; } else if(this.position == "up") { _loc2_._x = hero._x; _loc2_._y = hero._y - 30; } else if(this.position == "right") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y; } else if(this.position == "down") { _loc2_._x = hero._x; _loc2_._y = hero._y + 30; } else if(this.position == "upleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y - 30; } else if(this.position == "downleft") { _loc2_._x = hero._x - 30; _loc2_._y = hero._y + 30; } else if(this.position == "upright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y - 30; } else if(this.position == "downright") { _loc2_._x = hero._x + 30; _loc2_._y = hero._y + 30; } } if(audio_on) { sound.gotoAndPlay("punch"); } this.removeMovieClip(); } } } function nextLevel() { if(level == 9) { win(); return undefined; } score = tempscore; delete hero.onEnterFrame; hero.gotoAndStop("still"); game.removeMovieClip(); clearInterval(clock); attachMovie("proceed_screen","proceed_screen",1000,{_x:250,_y:250}); columnsound.gotoAndPlay(3); proceed_screen.score = score; score_field.text = score; proceed_screen.level = level; } function setNextLevel() { proceed_screen.removeMovieClip(); loadLevel(level + 1); } function die() { score = tempscore; delete hero.onEnterFrame; hero.gotoAndStop("still"); game.removeMovieClip(); clearInterval(clock); attachMovie("die_screen","die_screen",1000,{_x:250,_y:250}); columnsound.gotoAndPlay(3); die_screen.score = score; score_field.text = score; die_screen.level = level; } function win() { score = tempscore; delete hero.onEnterFrame; hero.gotoAndStop("still"); game.removeMovieClip(); clearInterval(clock); attachMovie("win_screen","win_screen",1000,{_x:250,_y:250}); sound.gotoAndPlay("gong"); win_screen.score = score; score_field.text = score; } function replay() { die_screen.removeMovieClip(); win_screen.removeMovieClip(); _root.gotoAndPlay(5); } stop(); var launchinterval; var speed; var handpos = "center"; var emittens; var bullets; var numbullets; var changedir; var circleinterval; var startang = 1.5707963267948966; var interval = 3.141592653589793; var bcircleinterval; var cycles; var elapsedcycles; var clock; var score = 0; var tempscore = 0; var hit; var health = 3; var level; var emittensquad = [[0,-1],[1,0],[0,1],[-1,0]]; var emittensoct = [[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1],[-1,0]]; var bullet1 = ["normal0","normal1","normal2","normal3"]; var bullet2 = ["normal0","normal1","normal2","normal3","bonus"]; var levels = [[5,1000,emittensquad,bullet2,1,false,20],[5,1000,emittensquad,bullet2,2,false,40],[6,1000,emittensquad,bullet2,2,true,40],[6,1000,emittensoct,bullet2,1,false,20],[7,1000,emittensoct,bullet2,2,false,40],[7,1000,emittensoct,bullet2,2,true,40],[8,1200,emittensquad,bullet2,2,true,50],[8,1200,emittensoct,bullet2,2,true,50],[8,1000,emittensoct,bullet2,2,true,60],[8,1000,emittensoct,bullet2,2,true,60]]; var hero; var audio_on = true; loadLevel(0);